<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddIsAdministratorIntoAdminUser extends Migration{
    /**
     * run migration
     * 运行迁移时应用
     * 数据表 admin user 中 添加字段
     */
    public function up(){
        Schema::table('admin_user', function(Blueprint $table){
            $table->tinyInteger('is_administrator')->after('password')
                ->nullable(true)->unsigned()->default(0)->comment('是否是超级管理员，0不是，1是，默认是0');
        });
    }

    /**
     * 回滚迁移时调用
     */
    public function down(){
        Schema::table('admin_user', function(Blueprint $table){
            $table->dropColumn('is_administrator');
        });
    }
}
